<!--
 * Created by PhpStorm.
 * User: jackhhy
 * Date: 2019/7/8-10:36
 * Link: https://gitee.com/luckygyl/lucky_admin
 * FileName: edit_member.html
 *-->

{include file="public/open_head" /}

<div class="ok-body">

    <div class="layui-fluid">
        <div class="layui-card">
            <!-- <div class="layui-card-header"></div>-->

            <div class="layui-card-body" style="padding: 15px;">
                <div class="layui-form">

                    <div class="layui-form-item">
                        <label class="layui-form-label">所属角色：</label>
                        <div class="layui-input-block">

                            <select name="role_id" lay-verify="required" >
                                {volist name="tree" id="t"}
                                <option value="{$t.id}" {eq name="$role_id" value="$t.id" }  selected {/eq} >{$t.title_show}</option>
                                {/volist}
                            </select>

                            <input type="hidden" name="id"  value="{$info.id}">
                        </div>
                    </div>

                    {:token()}


                    <?php $nickname=$info['nickname']; echo Form::Input('text','nickname',$nickname,'管理员昵称','请输入管理员昵称','required');?>

                    <div class="layui-form-item">

                        <?php $username=$info['username']; echo Form::Input('text','username',$username,'用户名','请输入管理员用户名','required','','','inline',2);?>

                        <?php $password=$info['password']; echo Form::Input('password','password',$password,'密码','请输入管理员密码','required','','','inline',2);?>

                    </div>


                    <div class="layui-form-item">

                        <?php $phone=$info['phone']; echo Form::Input('text','phone',$phone,'手机号','请输入手机号','required|phone','','','inline',2);?>

                        <?php $email=$info['email']; echo Form::Input('text','email',$email,'邮箱','请输入邮箱','','','','inline',2);?>

                    </div>

                    <?php $avatar=$info['avatar']; echo Form::Upthumb('avatar',$avatar,'头像','头像地址','required','上传头像');?>



                    <div class="layui-form-item">
                        <label class="layui-form-label">性别：</label>
                        <div class="layui-input-inline">
                            <select name="sex" lay-verify="required" >
                                <option value="男" {eq name="$info.sex" value="男" }  selected {/eq}>男</option>
                                <option value="女" {eq name="$info.sex" value="女" }  selected {/eq}>女</option>
                                <option value="保密" {eq name="$info.sex" value="保密" }  selected {/eq}>保密</option>
                            </select>
                        </div>

                        <?php $status=$info['status']; echo Form::Radio('status',$status,'状态',array('1'=>'正常','2'=>'拉黑'),'','','inline',2);?>

                    </div>


                    <?php echo Form::Submit();?>


                </div>
            </div>
        </div>
    </div>


</div>




<script>
    layui.use(['element', 'form', 'jquery','upload'], function () {
        var element = layui.element;
        var table = layui.table;
        var form = layui.form;
        var $ = layui.jquery;
        var upload=layui.upload;

        //图片上传
        upload.render({
            elem:'#LAY_avatarUpload'
            ,url: "{:url('admin/common/UpThumbImg')}" //头像上传地址
            ,accept: 'images' //
            ,acceptMime: 'image/*'
            ,size: 1024*9
            //,data:{width:400,height:600}
            ,before:function (res) {
                loading = layer.load(2, {
                    shade: [0.2, '#000'] //0.2透明度的白色背景
                });
            }
            ,done: function(data){
                layer.close(loading);
                if (data.code==1){
                    layer.msg(data.msg, {icon: 1, time: 1000},function () {
                        $("#demo1").attr("src",data.path);
                        $("#LAY_avatarSrc").val(data.path);
                    });
                } else {
                    layer.msg(data.msg, {icon: 5, time: 1000});
                }
            }
            ,error:function (red) {
                layer.close(loading);
                layer.msg("网络错误", {icon: 5, time: 1500});
            }
        });


        /**
         * 提交表单数据
         */
        form.on('submit(add)', function (data) {
            FormSubmit("{:url('adminmember/EditMember')}",data.field,"tableFilter",1);
            return false;
        });
    })
</script>


</body>
</html>
